import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Stack;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ${USER}
 * Date: ${YEAR}-${MONTH}-${DAY}
 * Time: ${TIME}
 */
public class Main {
    public static void main(String[] args) {


    }
}
class Solution1 {
    public boolean containsDuplicate(int[] nums) {
        Arrays.sort(nums);
        for (int i = 0; i < nums.length-1; i++) {
            if(nums[i]==nums[i+1]){
                return true;
            }
        }
        return false;
    }
}
class Solution2 {
    public char nextGreatestLetter(char[] letters, char target) {
int i=0;
int j=letters.length-1;
while(i<=j){
    int m=(i+j)>>>1;
    if(letters[m]>target){
        j=m-1;
    }else {
        i=m+1;
    }
}
return letters[i];
    }
}
class Solution3 {
    public int arrangeCoins(int n) {
        int m=0;
        for (int i = 1; i <=n; i++) {

m=i;
if(n<i){
    return  i-1;

}
            n-=i;
        }
        return  m;
    }
}
class Solution4 {
    public int[] twoSum(int[] nums, int target) {
        int arr[]=new int[2];
        for (int i = 0; i < nums.length; i++) {
            for (int j = 0; j < nums.length; j++) {
                if(nums[i]+nums[j]==target){
                 arr[0]=i;
                 arr[1]=j;
                }
            }
        }
        return  arr;
    }
}
class Solution6 {
    public int countNegatives(int[][] grid) {
int a=0;
        for (int i = 0; i < grid.length; i++) {
            for (int j = 0; j <grid[i].length ; j++) {
                if(grid[i][j]<0){
                    a++;
                }
            }
        }
        return a;
    }
}
class Solution {
    public boolean checkIfExist(int[] arr) {
Arrays.sort(arr);
int a=0;
int b=1;
while(b==arr.length || a==arr.length) {
    int i = arr[a];
    int j = arr[b];
    if(i*2<j){
        j++;
    }else if(i*2>j){
        i++;
    }else {
        return  true;
    }

}
return false;
    }
}
